package com.bush.mall.product.controller;

import org.springframework.web.bind.annotation.*;
import com.bush.mall.common.entity.Result;;
import com.bush.mall.product.entity.ProductAttrValueEntity;
import com.bush.mall.product.service.ProductAttrValueService;
import javax.annotation.Resource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * spu属性值
 * @author RUN
 * @date 2022-11-28
 */
@RestController
@RequestMapping("productattrvalue")
@Api(tags = "spu属性值管理" )
public class ProductAttrValueController {

    @Resource(name= ProductAttrValueService.BEAN_ID)
    private ProductAttrValueService productAttrValueService;

    /**
     * 分页查询spu属性值列表
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "分页查询spu属性值列表")
    @GetMapping("queryForPage")
    public Result queryForPage(Integer current,Integer size){
        return productAttrValueService.queryForPage(current,size);
    }

    /**
     * 保存spu属性值表单
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "保存spu属性值表单")
    @PostMapping("saveProductAttrValue")
    public Result saveProductAttrValue(@RequestBody ProductAttrValueEntity productAttrValue){
        return productAttrValueService.saveProductAttrValue(productAttrValue);
    }

    /**
     * 修改spu属性值表单
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "修改spu属性值表单")
    @PutMapping("updateProductAttrValue")
    public Result updateProductAttrValue(@RequestBody ProductAttrValueEntity productAttrValue){
        return productAttrValueService.updateProductAttrValue(productAttrValue);
    }

    /**
     * 通过指定id删除spu属性值
     * @author RUN
     * @date 2022-11-28
     */
    @ApiOperation(value = "通过指定id删除spu属性值")
    @DeleteMapping("deleteProductAttrValue")
    public Result deleteProductAttrValue(Long id){
        return productAttrValueService.deleteProductAttrValue(id);
    }

}
